<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>手机充电旋转融合</title>
    <link rel="stylesheet" href="CSS/index.css">
</head>

<body>
    <div class="charging">
        <div class="electricity"></div>
        <div class="main"></div>
        <span class="up"></span>
        <span class="up"></span>
        <span class="up"></span>
        <span class="up"></span>
        <span class="up"></span>
        <span class="up"></span>
        <span class="up"></span>
        <span class="up"></span>
        <span class="up"></span>
        <span class="up"></span>

        <div class="origin"></div>
    </div>
    <script>
        let electricity = document.querySelector('.electricity');
        let num = parseInt(Math.random() * 100);
        electricity.innerHTML = (num + '%');
        let timer = setInterval(function () {
            num += 1;
            electricity.innerHTML = (num + '%');
            if (num === 100) {
                clearInterval(timer);
            }
        }, 1000);

    </script>
</body>

</html>